package top.z98242312.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;
import top.z98242312.client.ProviderClient;

/**
 * @author zyz
 * @site
 * @company
 * @Email 1479787237@qq.com
 * @create 2020-09-04 14:09
 */
@RestController
public class ConsumerController {

    @Autowired
    RestTemplate restTemplate;

    @Autowired
    ProviderClient providerClient;

    @GetMapping("/hi-RestTemplate")
    public String hiRestTemplate(){
        return restTemplate.getForObject("http://nacos-provider/hi?name=RestTemplate",String.class);
    }

    @GetMapping("/hi-Feign")
    public  String hiFeign(){
        return providerClient.hi("feign");
    }
}
